package com.leon.datalink.web.security;

import io.jsonwebtoken.io.Decoders;
import org.springframework.context.annotation.Configuration;

/**
 * Simplified DataLink Auth Configuration
 * Contains only constants needed by other classes
 */
@Configuration
public class DatalinkAuthConfig {

    public static final String AUTHORIZATION_HEADER = "Authorization";
    public static final String TOKEN_PREFIX = "Bearer ";

    // Default token validity in seconds (5 hours)
    private int tokenValidityInSeconds = 18000;

    // Secret key for JWT signing
    private String secretKey = "ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWE1MmJjMDUyZGIzOTJkNDI=";

    public int getTokenValidityInSeconds() {
        return tokenValidityInSeconds;
    }

    public void setTokenValidityInSeconds(int tokenValidityInSeconds) {
        this.tokenValidityInSeconds = tokenValidityInSeconds;
    }

    public byte[] getSecretKeyBytesDecoders() {
        return Decoders.BASE64.decode(secretKey);
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
}
